package com.sky.controller.user;

import com.sky.context.BaseContext;
import com.sky.result.Result;
import com.sky.utils.RedisUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.sky.constant.RedisConstant.KEY_STATUS;

/**
 * @Author : xiongke
 * @Description:
 * @Date: 2024/8/29
 */
@RestController("userShopController")
@RequestMapping("/user/shop/")
@Api(tags = "用户端商铺接口")
@Slf4j
public class ShopController {

    @Resource
    RedisUtil redisUtil;

    @GetMapping("/status")
    @ApiOperation("查询店铺营业状态")
    public Result getShopStatus(){
        log.info("查询当前店铺营业状态");
        String value = (String) redisUtil.get(KEY_STATUS);
        if (value == null){
            value = "0";
        }
        int result = Integer.parseInt(value);
        return Result.success(result);
    }

}
